package com.shao.onlinepdf.controller;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.shao.onlinepdf.entity.TStyle;
import com.shao.onlinepdf.service.ITStyleService;

/**
 *
 * @author shaohuailin
 * @date 2021/09/06
 */
@RestController
@RequestMapping("/style")
public class StyleController {
    
    @Autowired
    private ITStyleService styleService;
    
    @GetMapping("/{id}")
    public String id(@PathVariable String id) {
        TStyle style = styleService.getById(id);
        return Optional.ofNullable(style).map(TStyle::getCss).orElse("");
    }
}
